package com.example.homework

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter

class TabAdapter(fm:FragmentManager,behavior:Int) : FragmentPagerAdapter(fm,behavior) {

    private val titles = listOf("第一个标签","第二个标签","第三个标签")
    private val fragments = titles.map { TabFragment(it) }

    override fun getItem(position: Int): Fragment = fragments[position]

    override fun getCount(): Int = titles.size

    override fun getPageTitle(position: Int): CharSequence? {
        return titles[position]
    }
}